package com.aaa.ssm.controller;

import com.aaa.ssm.entity.TSbsnOrder;
import com.aaa.ssm.service.TSbsnOrderService;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
//订单表
@RestController
@RequestMapping("tsb")
public class TSbsnOrderController extends BaseController {
    @Resource
    private TSbsnOrderService tSbsnOrderService;

    /**
     * 分页带参查询
     * @param page
     * @return
     */
    @PostMapping("queryPage")
    public Result queryPage(@RequestBody Page<TSbsnOrder> page){
        return success(tSbsnOrderService.queryPage(page));
    }

    /**
     * 根据用户编号查询订单数据
     * @param page
     * @return
     */
    @PostMapping("queryMyOrder")
    public Result queryMyOrder(@RequestBody Page<TSbsnOrder> page){
        return success(tSbsnOrderService.queryMyOrder(page));
    }

    /**
     * 根据编号查询
     * @param orderid
     * @return
     */
    @GetMapping("queryById")
    public Result queryById(Integer orderid){
        return success(tSbsnOrderService.queryById(orderid));
    }

    /**
     * 添加数据
     * @param tSbsnOrder
     * @return
     */
    @PostMapping("TsbAdd")
    public Result TsAdd(@RequestBody TSbsnOrder tSbsnOrder){
        return success(tSbsnOrderService.TSbsnOrderAdd(tSbsnOrder));
    }

    /**
     * 修改数据
     * @param tSbsnOrder
     * @return
     */
    @PostMapping("TsbUpdate")
    public Result TsUpdate(@RequestBody TSbsnOrder tSbsnOrder){
        return success(tSbsnOrderService.TSbsnOrderUpdate(tSbsnOrder));
    }

    /**
     * 根据订单号删除数据
     * @param orderno
     * @return
     */
    @RequestMapping("TsbDelete/{orderno}")
    public Result TsDelete(@PathVariable String  orderno){
        return success(tSbsnOrderService.TSbsnOrderDelete(orderno));
    }
}
